package com.car.json;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.car.util.ConnectionPool;

public class BitAutoBBSUrlSpell {
	private Connection conn = ConnectionPool.getConnection("carvoice_core", "root", "zhouzhou100428", "192.168.1.168");

	public List<String> geturl() {
		List<String> list = new ArrayList<>();
		Statement st = null;
		ResultSet rs = null;
		String sql = "SELECT bitauto_urlspell AS url FROM core_brand_bitauto";
		try {
			st = conn.createStatement();
			rs = st.executeQuery(sql);
			while (rs.next()) {
				String url = rs.getString("url");
				list.add(url);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;

	}

	public void insertBBSUrl(String bbsurl, String urlspell) {
		Statement st = null;
		String sql = "UPDATE core_brand_bitauto SET bitauto_bbsurl='" + bbsurl + "' WHERE bitauto_urlspell='" + urlspell
				+ "'";
		try {
			st = conn.createStatement();
			st.executeUpdate(sql);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
}
